package com.example.wlt.personnel_manegement_system.Adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.wlt.personnel_manegement_system.Item.Item_memberlist;
import com.example.wlt.personnel_manegement_system.R;

import java.util.List;

/**
 * Created by WLT on 2016/5/26.
 */
public class MemberlistAdapter extends BaseAdapter {
    private List<Item_memberlist> mList;
    private LayoutInflater mInflater;
    public MemberlistAdapter(Context context,List<Item_memberlist> List) {
        mList=List;
        mInflater=LayoutInflater.from(context);
    }

    @Override
    public int getCount() {
        return mList.size();
    }

    @Override
    public Object getItem(int position) {
        return mList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder=null;
        if(convertView==null) {
            convertView = mInflater.inflate(R.layout.organization_member_item, null);
            holder = new ViewHolder();
            holder.name = (TextView) convertView.findViewById(R.id.tv_organization_name);
            convertView.setTag(holder);
        }else {
            holder=(ViewHolder)convertView.getTag();
        }
        Item_memberlist mItem=mList.get(position);
        holder.name.setText(mItem.Itemname);
        return convertView;
    }
    class ViewHolder{
        protected TextView name;
    }
}
